const USET_KEY = {
    "姓名":'username',
    "联系方式":'mobile',
    "角色":'role',
    "开通时间":'openTime'
}

const formatDate = (numb) => {
    const time = new Date((numb - 1) * 24 * 3600000 + 1)
    time.setYear(time.getFullYear() - 70)
    const year = time.getFullYear() + ''
    const month = time.getMonth() + 1 + ''
    const date = time.getDate() - 1 + ''
    return (
      year +
      '-' +
      (month < 10 ? '0' + month : month) +
      '-' +
      (date < 10 ? '0' + date : date)
    )
  }

  export const generateData=(data)=>{
      let arr = [];
      data.forEach((item,index)=>{
          let userInfo = {};
          Object.keys(item).forEach(key=>{
              if(USET_KEY[key]=='openTime'){
                  userInfo[USET_KEY[key]]= formatDate(item[key])
                  return;
              }
              userInfo[USET_KEY[key]]=item[key]
          })
          arr.push(userInfo)
      })
      return arr
  }